package com.joysuch.wwyt.risk.repository;

import com.joysuch.wwyt.risk.entity.RiskEvaluationTargetType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface RiskEvaluationTargetTypeDao extends JpaRepository<RiskEvaluationTargetType,Long> {
    int countByNameAndMethodId(String name, Long methodId);

    int countByMethodId(Long id);

    List<RiskEvaluationTargetType> findByMethodId(Long methodId);

    @Query(value = "select id from wwyt_risk_evaluation_target_type where method_id = ?1 and delete_flag = '0'",nativeQuery = true)
    List<Long> getIdsByMethodId(Long id);
}
